﻿using System.Collections.Generic;
using System.Web.Mvc;
using InnovaApp.Layers.MetaDataLayer;
using InnovaApp.Portals.MVC4Portal.Models.MetaModels.ContactManagement;
using InnovaApp.Portals.MVC4Portal.Models.MetaModels.OrderManagement;

namespace InnovaApp.Portals.MVC4Portal.Models.MetaModels
{
	/// <summary>
	/// All MetaModels inherit from MetaData (same structure as domain (entities) objects but with MVC Data Annotations decorations)
	/// </summary>
	public class Order_MetaModel : Order_MetaData
	{
        /// <summary>
        /// This is the editor to Add a row
        /// </summary>
        public OrderDetail_MetaModel NewRow { get; set; }

        /// <summary>
        /// Domain class are all serializable. We use it here to allow dirty details input and save at end
        /// </summary>
        public List<OrderDetail_MetaModel> Details { get; set; }

        public OrderTotal_MetaModel Totals { get; set; }

        public List<SelectListItem> DeliveryModes { get; set; }
        public List<SelectListItem> DeliveryAddresses { get; set; }
        public List<SelectListItem> InvoicingAddresses { get; set; }
        public List<SelectListItem> Products { get; set; }

        public ContactViewer_MetaModel CurrentContact { get; set; }

        /// <summary>
        /// Neutral constructor
        /// </summary>
        public Order_MetaModel()
            : base()
        {
            this.NewRow = new OrderDetail_MetaModel();
            this.Details = new List<OrderDetail_MetaModel>();
            this.DeliveryModes = new List<SelectListItem>();
            this.DeliveryAddresses = new List<SelectListItem>();
            this.InvoicingAddresses = new List<SelectListItem>();
            this.Products = new List<SelectListItem>();
            this.Totals = new OrderTotal_MetaModel();
            this.CurrentContact = new ContactViewer_MetaModel();
        }
    }
}